<?php 
/* P3(c)

******************************************************************************
                                                                                      
                         __                                                        
                        /__)                                                       
                       /__        P3 - moving Technologie            
                        __)                                                          
                        __)                                                          
                                                                                        
                                                                                        
       Copyright 2009 by p3.co.at                                                                                 
                                                                                        
       visit www.p3.co.at to get more Informations 
       about Teriko - Betriebsdatenerfassung                                                                                 
       - it's not allowed to change this scripts
       - it's not allowed to remove this copyright-tag

       -- you can download the complete license   
          under http://www.teriko.org

 (c) by Patrik Pfaffenbauer and P3 (http://www.p3.co.at)

 | Programname: P3.Teriko
 | Authtor: P3.Verein
 | Coder: Patrik Pfaffenbauer
 | Version: 0.1

 | Change Index
 |_____________________________________________
 |                                             |
 |4.3.2010 Erstellung | Patrik Pfaffenbauer    |
 |_____________________________________________|

******************************************************************************

P3(c) */
 

class WeeklyWorkTime
{
	function  WeeklyWorkTime()
	{
		
	}
	
	function Analyse()
	{
		
		if($_POST['action'] == "paint")
		{
			$this->PaintReport();
		}
		else
		{
			include("../../_config.php");
			echo '
			<head>
				<script type="text/javascript" src="../../js/datepickercontrol.js"></script>
				<link type="text/css" rel="stylesheet" href="../../css/date.css"> 
			</head>
			<body>
				<form method="post" action="WeeklyWorkTime.php">
					<table>
						<tr>
							<td>
								Von: 
							</td>
							<td>
								<input type="hidden" id="DPC_TODAY_TEXT" value="'.$GLOBALS['lang']->GetReportLanguage("Calender", "today").'">
								<input type="hidden" id="DPC_BUTTON_TITLE" value="'.$GLOBALS['lang']->GetReportLanguage("Calender", "open").'">
								<input type="hidden" id="DPC_MONTH_NAMES" value="'.$GLOBALS['lang']->GetReportLanguage("Calender", "months").'">
								<input type="hidden" id="DPC_DAY_NAMES" value="'.$GLOBALS['lang']->GetReportLanguage("Calender", "days").'">
								<input type="text" name="from" id="DPC_from_'.$GLOBALS['lang']->GetReportLanguage("Calender", "format").'" value="'.$value.'"/> 
								
							</td>
						</tr>
						<tr>
							<td>
								Bis: 
							</td>
							<td>
								<input type="hidden" id="DPC_TODAY_TEXT" value="'.$GLOBALS['lang']->GetReportLanguage("Calender", "today").'">
								<input type="hidden" id="DPC_BUTTON_TITLE" value="'.$GLOBALS['lang']->GetReportLanguage("Calender", "open").'">
								<input type="hidden" id="DPC_MONTH_NAMES" value="'.$GLOBALS['lang']->GetReportLanguage("Calender", "months").'">
								<input type="hidden" id="DPC_DAY_NAMES" value="'.$GLOBALS['lang']->GetReportLanguage("Calender", "days").'">
								<input type="text" name="till" id="DPC_till_'.$GLOBALS['lang']->GetReportLanguage("Calender", "format").'" value="'.$value.'"/> 
								
							</td>
						</tr>
						<tr>
							<td>
								Mitarbeiter
							</td>
							<td>
								<input type="text" name="userid" value="" />
							</td>
						</tr>
						<tr>
							<td>
								<input type="submit" value="Auswerten" name="submit" />
							</td>
						</tr>
					</table>
					<input type="hidden" value="paint" name="action" />
				</form>
			</body>
			';
		}
	}
	
	function PaintReport()
	{
		include("../engine/ReportEngine.inc.php");
		
		$xml = simplexml_load_file('../xml/WeeklyWorkTime.xml');
		
		
		$pdf = new ReportEngine('L','pt','A3');
		$pdf->xml = "WeeklyWorkTime.xml";
		$pdf->SetFont('Times','','10');
		$pdf->AliasNbPages();
		$pdf->ConnectToMysql();
		$attr=array('titleFontSize'=>20,'titleText'=>'P3.Teriko - '.$xml->{"SystemInfo"}->{"ReportName"});

		$_POST['from'] = ConvertDate($_POST['from'], ".");
		$_POST['till'] = ConvertDate($_POST['till'], ".");
		
		//echo "CALL R_WeeklyWorkTimeDate('".$_POST['from']."', '".$_POST['till']."', ".$_POST['userid'].");";
		$pdf->BuildReport("CALL R_WeeklyWorkTimeDate('".$_POST['from']."', '".$_POST['till']."', ".$_POST['userid'].");",false,$attr);
	}
}

$report = new WeeklyWorkTime();
$report->Analyse();
?>